package com.xh.demo.feign;

import com.xh.demo.commons.model.response.R;
import com.xh.demo.feign.fallback.ProductStockFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * @author wen
 * @apiNote ProductStockServiceFeign
 * @since 2021-12-10
 */
@FeignClient(
        name = "product-center",
        contextId = "product-stock",
        path = "/product/stock",
        fallbackFactory = ProductStockFeignFallback.class
//        configuration = {FeignInterceptor.class}
)
public interface ProductStockServiceFeign {

    @GetMapping("/v1/{sku-id}")
    R<Integer> detail(@PathVariable("sku-id") Long skuId);

    @GetMapping("/v1/detail/{sku-id}")
    R<String> detailV2(@PathVariable("sku-id") Long id);

    @PutMapping("/v1/{sku-id}")
    R<String> reStock(@PathVariable("sku-id") Long id);
}
